#!/usr/bin/env bash

# SPDX-FileCopyrightText:  2020-2021 zPlus <zplus@peers.community>
# SPDX-License-Identifier: CC0-1.0

if [ -z "$PAGURE_PATH" ]; then
    echo "envvar PAGURE_PATH not set."
    exit
fi

if [ -z "$PAGURE_CONFIG" ]; then
    echo "envvar PAGURE_CONFIG not set."
    exit
fi

# Add Pagure to PYTHONPATH so that the tasks can import the Pagure config
export PYTHONPATH=$PYTHONPATH:$PAGURE_PATH

# Start forgefed worker
celery worker --hostname=forgefed@%h \
              --loglevel=DEBUG \
              --app=forgefed.tasks \
              --queues=forgefed
